import { ResPage } from "@/api/interface/index";
import http from "@/api";
import { Message, Notice } from "../interface/system";

/**
 * @name 系统模块
 */
export const getMessageListApi = (pageNum: number, pageSize: number, wrapper?: Partial<Message>) => {
	return http.post<ResPage<Message>>(`/message/getList/${pageNum}/${pageSize}`, { wrapper });
};

export const getMessageDetailApi = (id: number) => {
	return http.get<Message>(`/message/getDetail/${id}`);
};

export const addMessageApi = (message: Message) => {
	return http.post<string>("/message/create", message);
};

export const updateMessageApi = (message: Partial<Message>) => {
	return http.post<string>("/message/update", message);
};

export const deleteMessageApi = (id: number) => {
	return http.delete<string>(`/message/delete/${id}`);
};

export const getNoticeListApi = (pageNum: number, pageSize: number, wrapper?: Partial<Notice>) => {
	return http.post<ResPage<Notice>>(`/notice/getList/${pageNum}/${pageSize}`, { wrapper });
};

export const getNoticeDetailApi = (id: number) => {
	return http.get<Notice>(`/notice/getDetail/${id}`);
};

export const addNoticeApi = (message: Notice) => {
	return http.post<string>("/notice/create", message);
};

export const updateNoticeApi = (message: Partial<Notice>) => {
	return http.post<string>("/notice/update", message);
};

export const deleteNoticeApi = (id: number) => {
	return http.delete<string>(`/notice/delete/${id}`);
};
